package com.sec.android.app.myfiles.module.local.recent;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.sec.android.app.myfiles.R;
import com.sec.android.app.myfiles.fragment.home.HomeFragment;
import com.sec.android.app.myfiles.fragment.home.HomeFragmentItem;
import com.sec.android.app.myfiles.module.abstraction.FileRecord;
import com.sec.android.app.myfiles.util.PreferenceUtils;
import com.sec.android.app.myfiles.util.UiUtils;

public class PickerRecentHomeItem extends HomeFragmentItem {

    public PickerRecentHomeItem(Context context, HomeFragment fragment) {
        super(context, fragment);
    }


    @Override
    protected void setListItem() {
        HomeItemInfo item;
        HomeItemClickListener onclick;
        FileRecord record;

        record = UiUtils.getRecentRecord();
        onclick = new HomeItemClickListener(record, null);
        item = new HomeItemInfo(R.id.home_list_item_recent_stub, R.id.home_list_item_recent, R.drawable.my_files_ic_recent_files,
                R.color.home_icon_recent_color, 0, R.string.subtitle_recent, onclick);
        TextView sizeView = (TextView) item.itemView.findViewById(R.id.home_list_item_text_second);
        setViewVisibility(sizeView, View.GONE);
        mItemList.add(item);

    }

    @Override
    protected void _onPause() {

    }

    @Override
    protected void _onResume() {
        View homeLayout = mRootView.findViewById(R.id.home_recent);
        View homeRecentFilesHeader = mRootView.findViewById(R.id.home_recentfiles_header);
        if (PreferenceUtils.getShowRecentFiles(mContext)) {
            setViewVisibility(homeLayout, View.VISIBLE);
        } else {
            setViewVisibility(homeLayout, View.GONE);
        }
        setViewVisibility(homeRecentFilesHeader, View.GONE);
    }

    @Override
    protected void _onDestroy() {
    }
}